<link href="../addons/jy_merch/css/style.css"  rel="stylesheet" />
<div class="fui-page page-merch-register">
    <div class="fui-content">
        <img class="regbg" style="max-height:10rem" src="{{pagedata.set.regbg}}"/>
		<div ng-if="pagedata.post.id">
                        <div ng-if="pagedata.post.status==2" class="fui-alert fui-alert-danger">
                            <p>您的申请被驳回：</p>
                            <p>{{pagedata.post.reason}}</p>
                            <p>您也可以修改信息重新提交</p>
                        </div>
                        <div ng-if="pagedata.post.id>0 && pagedata.post.status==0" class="fui-alert fui-alert-warning">
                            <p>您已经提交了信息，请等待我们联系您!</p>
                            <p>您也可以修改信息重新提交</p>
                        </div>
						<div ng-if="pagedata.post.status==1" class="fui-alert fui-alert-warning">
                            <p>您已经提交了信息，已审核通过!</p>
                            <p><a class="btn btn-danger" href="javascript:;" ng-click="access_json('jy_newpaimerch/merch.index/')">前往商户中心</a></p>
                        </div>
		</div>
		<div ng-if="!pagedata.post.id || pagedata.post.status==2">
        <div class="fui-cell-group">
			<div class='fui-cell'>
                <div class='fui-cell-label'>已有商户？</div>
                <div class='fui-cell-info'>
				点击登录已有商户
				</div>
				<div class='fui-cell-remark noremark'>
					<a class="weui_btn weui_btn_primary" style="border-radius:1rem;" href="javascript:;" ng-click="access_json('jy_newpaimerch/merch.login//loginup=1');">登录已有商户</a>
				 </div>
            </div>
            <div class="fui-cell must ">
                <div class="fui-cell-label">商户名称</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" id="merchname" placeholder="商户名称" ng-model="pagedata.post.merchname"/></div>
            </div>
            <div class="fui-cell">
                <div class="fui-cell-label">主营项目</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" id="salecate" placeholder="例如鞋帽, 化妆品等" ng-model="pagedata.post.salecate"/></div>
            </div>
			<div class="fui-cell">
                <div class="fui-cell-label">商户分类</div>
				<div class="fui-cell-text">
					<select class="weui_select" style="padding:0.3rem" name="cateid2" ng-model="pagedata.post.cateid">
                        <option ng-repeat="q in pagedata.cate" value="{{q.id}}">{{q.catename}}</option>
					</select>
				 </div>
            </div>
            <div class="fui-cell ">
                <div class="fui-cell-label">简单介绍</div>
                <div  class="fui-cell-info"><textarea id="desc" ng-model="pagedata.post.desc" placeholder="简单介绍下商户"></textarea></div>
            </div>

        </div>
		<div class="fui-list-group">
            <div class="fui-list">              
                <div class="fui-list-inner">
                    <div class="title">营业执照/许可证</div>
                </div>
				<a class="fui-list-media" ng-if="pagedata.post.codeimg">
					<img ng-repeat="img in pagedata.post.codeimg" class="round" src="{{tomedia(img) || '../core/resource/images/nopic.jpg'}}" />
				</a>
                <a class="fui-list-media weui_uploader_input_wrp">
					<span class="weui_uploader_input" ng-click="images(pagedata.post,'codeimg')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple=""></span>
				</a>
            </div>
        </div>
        <div class="fui-cell-group">
            <div class="fui-cell must ">
                <div class="fui-cell-label">联系人</div>
                <div class="fui-cell-info"><input type="text" class="fui-input must_set" onblur="scope.tool.must_set($(this));" id="realname" placeholder="您的称呼" ng-model="pagedata.post.realname"></div>
            </div>
            <div class="fui-cell must">
				<div class="fui-cell-label">手机号</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入您的手机号"  ng-model="pagedata.post.mobile" /></div>
				<div ng-if="pagedata.pluginset.is_smscode==1" class="fui-cell-remark noremark"><a class="btn btn-default btn-default-o btn-sm" ng-click="tool.mobile_code(pagedata.post.mobile,'smscode')" id="smscode">获取验证码</a></div>
			</div>
			<div ng-if="pagedata.pluginset.is_smscode==1" class="fui-cell must ">
				<div class="fui-cell-label ">验证码</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入验证码" ng-model="pagedata.post.smscode" /></div>
			</div>
            <div class="fui-cell-tip">请仔细填写联系方式，保证我们能尽快联系到您~</div>

        </div>
		 <div class="fui-cell-group">
			<div class="fui-cell must">
                <div class="fui-cell-label">所在城市</div>
				<div class="fui-cell-info" style="padding:0.2rem;border: 1px solid #D9D9D9;">
						<select class="fui-input" ng-model="pagedata.post.pcd.province"  ng-change="pagedata.post.pcd.city=undefined;pagedata.post.pcd.district=undefined;pagedata.post.pcd.street=undefined">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.areas" ng-selected="pagedata.post.pcd.province==value"  value="{{value}}">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-info" style="padding:0.2rem;border: 1px solid #D9D9D9;">
						<select class="fui-input" ng-model="pagedata.post.pcd.city" ng-change="pagedata.post.pcd.district=undefined;pagedata.post.pcd.street=undefined">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.areas[pagedata.post.pcd.province]" ng-selected="pagedata.post.pcd.city==value" value="{{value}}">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-info" style="padding:0.2rem;border: 1px solid #D9D9D9;">
						<select class="fui-input" ng-model="pagedata.post.pcd.district" ng-change="pagedata.post.pcd.street=undefined">
							<option value="" selected="selected">区县</option>
							<option ng-repeat="(value,data) in pagedata.areas[pagedata.post.pcd.province][pagedata.post.pcd.city]" ng-selected="pagedata.post.pcd.district==value" value="{{value}}">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-info" style="padding:0.2rem;border: 1px solid #D9D9D9;">
						<select class="fui-input" ng-model="pagedata.post.pcd.street">
							<option value="" selected="selected">街道</option>
							<option ng-repeat="value in pagedata.areas[pagedata.post.pcd.province][pagedata.post.pcd.city][pagedata.post.pcd.district]" ng-selected="pagedata.post.pcd.street==value" value="{{value}}">{{value}}</option>
						</select>
					</div>
			</div>
            <div class="fui-cell must">
                <div class="fui-cell-label">店铺地址</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" id="address" placeholder="店铺地址" ng-model="pagedata.post.addressinfo.address"></div>
				<div class="fui-cell-remark" ng-click="tool.choose_location(pagedata.post,'addressinfo')"><i class="icon icon-ditu"></i></div>
			</div>
			 <div class="fui-cell">
				 <div class="fui-cell-label">选择坐标</div>
			 </div>
			 <div class="fui-cell">
				 <div class="fui-cell-info">
					<input type="text" ng-model="pagedata.post.addressinfo.lat_lng.lng" placeholder="经度"  class="form-control"/>
				 </div>
				 <div class="fui-cell-info" style="margin-left:0.5rem">
					<input type="text" ng-model="pagedata.post.addressinfo.lat_lng.lat" placeholder="纬度"  class="form-control"/>
				 </div>
				 <div class="fui-cell-remark noremark" style="margin-left:0.5rem">
					<a ng-click="tool.choose_location(pagedata.post.addressinfo,'lat_lng','lat_lng')" class="btn btn-default btn-default-o btn-sm" type="button">选择坐标</a>
				 </div>
			 </div>
        </div>
		<div ng-if="pagedata.post.diyfields.length>0" class="weui_cells_title">其他内容</div>
		<div ng-include="sys_html('common/_diyform',true)"></div>
        <div class="fui-cell-group">
            <div class="fui-cell must ">
                <div class="fui-cell-label">帐号</div>
                <div class="fui-cell-info"><input type="text" class="fui-input must_set" onblur="scope.tool.must_set($(this));" id="uname" placeholder="帐号" ng-model="pagedata.post.uname" maxlength="20"></div>
            </div>
            <div class="fui-cell must ">
                <div class="fui-cell-label">密码</div>
                <div class="fui-cell-info"><input type="password" class="fui-input" id="upass" placeholder="密码"  ng-model="pagedata.post.upass" maxlength="20"/></div>
            </div>
            <div class="fui-cell-tip">用于登录多商户后台,请认真填写</div>
        </div>
               <div ng-if="pagedata.set.applytitle!=null && pagedata.set.applycontent!=null" class="fui-cell-group">
                <div class="fui-cell small ">
                    <div class="fui-cell-info">

                        <label class="checkbox-inline">
                            <input type="checkbox" class="fui-checkbox-primary" ng-click="pagedata.post.check=1" id="agree" ng-checked="pagedata.post.check==1"/> 我已经阅读并了解了<a ng-click="pagedata.show_xieyi=true" id="btn-apply" style="color:#337ab7;">【{{pagedata.set.applytitle}}】</a>。
                        </label>

                    </div>
                </div>

            </div>
	<div class='btn btn-danger block btn-submit' href="javascript:" ng-click="post(pagedata.post,'post')" >申请</div>
    </div>
    </div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.set.applytitle || '商户协议'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.set.applycontent)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.check=1;" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	window.scope.location(function(res){
			//console.log(res)
			scope.$evalAsync(function(){
				scope.pagedata.post.addressinfo.lat_lng=scope.pagedata.post.addressinfo.lat_lng?scope.pagedata.post.addressinfo.lat_lng:res.lat_lng
				scope.pagedata.post.addressinfo.address = scope.pagedata.post.addressinfo.address?scope.pagedata.post.addressinfo.address:res.address;
			});
	});
scope.pagedata.getprovince=function(){
	scope.get('core/member.set/getprovince/',function(res){
		scope.pagedata.areas=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
</script>